export class Tools {
	constructor(map, opts) {//opts=[“zoomplus”,“zoomsub”,“initview”]
		this.map = map;
		var listener;
	    var output;
	    var sketch;
	    var measureTooltipElement;
	    var measureTooltip;
		this.init(opts);
	      
    } 
    
	init (opts){
		var containerDiv = document.createElement('div');
        containerDiv.className = 'containerDrawDiv';
		// containerDiv.style= " top: 100px;position: absolute;right: 140px;";
		containerDiv.style.top="100px";
        containerDiv.style.position="absolute";
        containerDiv.style.right="140px";
		this.map.crtLayer();
		for( var i = 0; i<opts.length; i++){
			switch(opts[i])
			{
			case "zoomplus":
				this.addzoomplusTool();
			  break;
			case "zoomsub":
				this.addzoomsubTool();
			  break;
			case "initview":
				this.addinitViewTool();
			  break;
			case "drawpointlinepolygon":
				containerDiv = this.adddrawPLPTool(containerDiv);
				this.getAddFeatures();
			  break;
			case "linepolygonmeasure":
				this.addLineMeasure();
			  break;
			case "measureclear":
				this.addMeasureClear(containerDiv);
			  break;
			case "location":
				this.addLocation();
			  break;
			case "mark":
				this.addMarker();
			  break;
			case "MousePosition":
				this.addMousePositionControl();
			  break;
			case "ScaleLine":
				this.addScaleLineControl();
			  break;
			case "OverviewMap":
				this.addOverviewMapControl();
			  break;
			case "mapswitch":
				this.addMapSwitch();
				break;
			case "stopDraw":
				this.stopDraw(containerDiv);
			  	break;
			default:
			  alert("没有该工具！");
			break;
			}
		}	
	}
	/**
	 * 在地图上添加放大工具
	 */
	addzoomplusTool () {
		var me = this.map;
		var div = document.createElement('div');
		div.id = "zoomplus";
		div.className = 'zoomplus';
		div.title = '放大';
		this.map.el.dom.appendChild(div);
		div.onclick = function() {
			var old_zoom = me._map.getView().getZoom();
			var new_zoom = old_zoom + 1;
			me._map.getView().setZoom(new_zoom);
		}
	}
	/**
	 * 在地图上添加缩小工具
	 */
	addzoomsubTool (){
		var me = this.map;
		var div = document.createElement('div');
		div.id = "zoomsub";
		div.className = 'zoomsub';
		div.title = '缩小';

		this.map.el.dom.appendChild(div);
		div.onclick = function() {
			var old_zoom = me._map.getView().getZoom();
			var new_zoom = old_zoom - 1;
			me._map.getView().setZoom(new_zoom);
		}
	}
	/**
	 * 在地图上添加初始化View工具
	 */
	addinitViewTool(){
		var me = this.map;
		var init_zoom = me._map.getView().getZoom();
		var init_center = me._map.getView().getCenter();

		var div = document.createElement('div');
		div.id = "initView";
		div.className = 'initView';
		div.title = '还原';
		this.map.el.dom.appendChild(div);

		div.onclick = function() {
			me._map.getView().setZoom(init_zoom);
			me._map.getView().setCenter(init_center);
		}
	}
	/**
	 * 在地图上添加绘制点线面工具
	 */
	adddrawPLPTool(containerDiv){
		var me =this.map;
		var layersArray = this.map.getLayers().getArray();
		var measureLayer, measureLayerSource;
		for(var i=0; i<layersArray.length; i++){
			if(layersArray[i].getProperties().id == "measureLayer"){
				measureLayer = layersArray[i];
				measureLayerSource = measureLayer.getSource();
			}
		}
		
		var drawPointDiv = document.createElement('div');
		drawPointDiv.id="drawPoint";
		drawPointDiv.className = 'drawPoint';
		drawPointDiv.title = '画点';
		
		var drawLineDiv = document.createElement('div');
		drawLineDiv.id="drawLineString";
		drawLineDiv.className = 'drawLine';
		drawLineDiv.title = '画线';
		
		var drawPolygonDiv = document.createElement('button');
		drawPolygonDiv.id="drawPolygon";
		drawPolygonDiv.className = 'drawPolygon';
		drawPolygonDiv.innerHTML = '绘制';
//		var clearFont = document.createElement('i');
//		clearFont.innerHTML = '画面';
//		clearFont.className="iStyle";
//	    this.map.el.dom.appendChild(drawPointDiv);
//	    this.map.el.dom.appendChild(drawLineDiv);
		containerDiv.appendChild(drawPolygonDiv)
//		containerDiv.appendChild(clearFont)
	    this.map.map.a.appendChild(containerDiv);
	    var draw
	    /*drawPointDiv.onclick = function(e){//判断当前点击事件的div名称是哪一个
	    	var Draws = me._map.getInteractions().getArray();
	    	  for(var i=Draws.length-1; i>=0; i--){
	    		  me._map.removeInteraction(Draws[i]);
	    	  }
	    	if(draw){
		    	me._map.removeInteraction(draw); 
		    }
	    	draw = new ol.interaction.Draw({
		          source: measureLayerSource,
		          type: ('Point')
		        }); 
	    	me._map.addInteraction(draw); 
	    }
	    drawLineDiv.onclick = function(e){
	    	var Draws = me._map.getInteractions().getArray();
	    	  for(var i=Draws.length-1; i>=0; i--){
	    		  me._map.removeInteraction(Draws[i]);
	    	  }
	    	if(draw){
		    	me._map.removeInteraction(draw); 
		    }
	    	draw = new ol.interaction.Draw({
		          source: measureLayerSource,
		          type: ('LineString')
		        }); 
	    	me._map.addInteraction(draw); 
	    }
	    drawPolygonDiv.onclick = function(e){
	    	var Draws = me._map.getInteractions().getArray();
	    	  for(var i=Draws.length-1; i>=0; i--){
	    		  me._map.removeInteraction(Draws[i]);
	    	  }
	    	if(draw){
		    	me._map.removeInteraction(draw); 
		    }
	    	draw = new ol.interaction.Draw({
		          source: measureLayerSource,
		          type: ('Polygon')
		        }); 
	    	me._map.addInteraction(draw); 
	    }*/
	    var _this = this;
	    drawPolygonDiv.onclick = function(e){
	    	_this.map.beginDraw = true;
	    	draw = new ol.interaction.Draw({
		          source: measureLayerSource,
		          type: ('Polygon')
		        }); 
	    	_this.draw = draw;
	    	_this.map.addInteraction(draw); 
	    }
	    
	   
	    return  containerDiv;
	}
    
    drawPolygonEvent(){
        var layersArray = this.map.getLayers().getArray();
		var  measureLayerSource;
		for(var i=0; i<layersArray.length; i++){
			if(layersArray[i].getProperties().id == "measureLayer"){
				var measureLayer = layersArray[i];
				measureLayerSource = measureLayer.getSource();
			}
		}
        this.map.beginDraw = true;
        var draw = new ol.interaction.Draw({
              source: measureLayerSource,
              type: ('Polygon')
            }); 
        this.map.draw = draw;
        this.map.addInteraction(draw); 
        this.getAddFeatures();
        return measureLayerSource;
    }

    stopDrawEvent(){
        this.map.beginDraw = false;
        this.map.map.removeInteraction(_this.draw);
    }
    

    clearEvent(){
        var layersArray = this.map.getLayers().getArray();
		var  measureLayerSource;
		for (var i = 0; i < layersArray.length; i++) {
			if (layersArray[i].getProperties().id == "measureLayer") {
				var measureLayer = layersArray[i];
				measureLayerSource = measureLayer.getSource();
			}
        }
        measureLayerSource && measureLayerSource.clear();
     } 

	//停止绘制
	stopDraw(containerDiv){
		var drawPolygonDiv = document.createElement('button');
		drawPolygonDiv.id="drawPolygon_stop_cap";
		drawPolygonDiv.className = 'drawPolygon drawPolygon_stop_cap';
		drawPolygonDiv.innerHTML = '停止绘制';
		/*var clearFont = document.createElement('i');
		clearFont.innerHTML = '停止绘制';
		clearFont.className="iStyle";*/
		
		//删除绘制的图层装ext按钮
		var deletedrawDiv = document.createElement('span');
			deletedrawDiv.id = "deletedraw";
			deletedrawDiv.className = 'drawPolygon_deleteDraw';
			
		var deletedrawDivFont = document.createElement('button');
			deletedrawDivFont.className = 'drawPolygon drawPolygon_stop_cap';
			deletedrawDivFont.innerHTML = '删除绘制';
//			deletedrawDivFont.className="iStyle";
		
		containerDiv.appendChild(drawPolygonDiv);
//		containerDiv.appendChild(clearFont);
		
//		containerDiv.appendChild(deletedrawDivFont);
		containerDiv.appendChild(deletedrawDiv);
	    this.map.map.a.appendChild(containerDiv);
//		drawPolygonDiv.title = '停止绘制';
		//这个方法也可以就是性能不好，创建太多draw
//		_this.draw.setActive(false);
		var _this = this;
		$(drawPolygonDiv).on('click',function(e){
	    	_this.map.beginDraw = false;
            _this.map.map.removeInteraction(_this.draw);
            console.log("aa");
            console.log(_this.map.addFeas);
	    });
	}
	
	//选择要删除的图层
	deletePaintedLyrs(lyId){
//		   appmap.makeSelectable(['earthbolck','road'],true);
		this.map.makeSelectable([lyId],true);
	}
	
	getAddFeatures(){
		var layersArray = this.map.getLayers().getArray();
		var measureLayer, measureLayerSource;
		for(var i=0; i<layersArray.length; i++){
			if(layersArray[i].getProperties().id == "measureLayer"){
				measureLayer = layersArray[i];
				measureLayerSource = measureLayer.getSource();
			}
		}
		var me = this;
		 measureLayerSource.on('addfeature',function(){
			 var features = measureLayerSource.getFeatures();
			//console.log(features[features.length-1]);
			me.map.addFeas = features;
			me.map.measureLayer = measureLayer;
		 });
	}
	
	saveDK(){
		var me = this;
		var features = me._sourceMa.getFeatures();
		console.log(features[features.length-1]);
	}
	
	/**
	 * 在地图上添加测量工具
	 */
	addLineMeasure(){
		var me = this;
		var layersArray = me.map._map.getLayers().getArray();
		var measureLayer, measureLayerSource;
		for (var i = 0; i < layersArray.length; i++) {
			if (layersArray[i].getProperties().id == "measureLayer") {
				measureLayer = layersArray[i];
				measureLayerSource = measureLayer.getSource();
			}
		}

		var measureLineStringdiv = document
				.createElement('div');
		measureLineStringdiv.id = "LineString";
		measureLineStringdiv.className = 'measureLineString';
		measureLineStringdiv.title = "量距";
		me.map.el.dom.appendChild(measureLineStringdiv);

		var measurePolygondiv = document.createElement('div');
		measurePolygondiv.id = "Polygon";
		measurePolygondiv.className = 'measurePolygon';
		measurePolygondiv.title = "测面";
		me.map.el.dom.appendChild(measurePolygondiv);

		measureTooltipElement = document.createElement('div');
		measureTooltipElement.className = 'tooltip tooltip-measure';
		measureTooltip = new ol.Overlay({
			element : measureTooltipElement,
			offset : [ 0, -15 ],
			positioning : 'bottom-center'
		});
		me.map._map.addOverlay(measureTooltip);

		var draw = new ol.interaction.Draw({
			source : measureLayerSource,
			type : /** @type {ol.geom.GeometryType} */
			('Polygon')
		});
		measureLineStringdiv.onclick = function(e) {
			var Draws = me.map._map.getInteractions()
					.getArray();
			for (var i = Draws.length - 1; i >= 0; i--) {
				me.map._map.removeInteraction(Draws[i]);
			}
			if (draw) {
				me.map._map.removeInteraction(draw);
			}
			draw = new ol.interaction.Draw({
				source : measureLayerSource,
				type : (measureLineStringdiv.id)
			});
			me.map._map.addInteraction(draw);
			draw
					.on(
							'drawstart',
							function(evt) {
								var output;
								sketch = evt.feature;
								var tooltipCoord = evt.coordinate;
								listener = sketch
										.getGeometry()
										.on(
												'change',
												function(evt) {
													var geom = evt.target;
													if (geom instanceof ol.geom.Polygon) {
														output = geom
																.getArea()
																+ ' '
																+ 'km<sup>2</sup>';
														tooltipCoord = geom
																.getInteriorPoint()
																.getCoordinates();
													} else if (geom instanceof ol.geom.LineString) {
														output = geom
																.getLength()
																+ ' '
																+ 'm';
														tooltipCoord = geom
																.getLastCoordinate();
													}
													measureTooltipElement.innerHTML = output;
													measureTooltip
															.setPosition(tooltipCoord);

												});
							}, this);

			draw.on(
					'drawend',
					function(evt) {
						measureTooltipElement.className = 'tooltip tooltip-static';
						measureTooltip.setOffset([ 0,
								-7 ]);
						sketch = null;
						measureTooltipElement = null;
						me.createMeasureTooltip();
						ol.Observable.unByKey(listener);
					}, this);
		}
		measurePolygondiv.onclick = function(e) {
			var Draws = me.map._map.getInteractions()
					.getArray();
			for (var i = Draws.length - 1; i >= 0; i--) {
				me.map._map.removeInteraction(Draws[i]);
			}
			if (draw) {
				me.map._map.removeInteraction(draw);
			}
			draw = new ol.interaction.Draw({
				source : measureLayerSource,
				type : (measurePolygondiv.id)
			});
			me.map._map.addInteraction(draw);
			draw
					.on(
							'drawstart',
							function(evt) {
								var output;
								sketch = evt.feature;
								var tooltipCoord = evt.coordinate;
								listener = sketch
										.getGeometry()
										.on(
												'change',
												function(evt) {
													var geom = evt.target;
													if (geom instanceof ol.geom.Polygon) {
														output = geom
																.getArea()
																+ ' '
																+ 'km<sup>2</sup>';
														tooltipCoord = geom
																.getInteriorPoint()
																.getCoordinates();
													} else if (geom instanceof ol.geom.LineString) {
														output = geom
																.getLength()
																+ ' '
																+ 'm';
														tooltipCoord = geom
																.getLastCoordinate();
													}
													measureTooltipElement.innerHTML = output;
													measureTooltip
															.setPosition(tooltipCoord);

												});
							}, this);

			draw
					.on(
							'drawend',
							function(evt) {
								measureTooltipElement.className = 'tooltip tooltip-static';
								measureTooltip.setOffset([ 0,
										-7 ]);
								sketch = null;
								measureTooltipElement = null;
								me.createMeasureTooltip();
								ol.Observable.unByKey(listener);
							}, this);
		}
	}

	/**
	 * 测量时创建输出框
	 */
	createMeasureTooltip() {
		var me = this.map;
		if (measureTooltipElement) {
			measureTooltipElement.parentNode
					.removeChild(measureTooltipElement);
		}
		measureTooltipElement = document.createElement('div');
		measureTooltipElement.className = 'tooltip tooltip-measure';
		measureTooltip = new ol.Overlay({
			element : measureTooltipElement,
			offset : [ 0, -15 ],
			positioning : 'bottom-center'
		});
		me._map.addOverlay(measureTooltip);
      }

	 /**
	 * 在地图上添加测量清除工具
	 */
	addMeasureClear(containerDiv) {
		var layersArray = this.map.getLayers().getArray();
		var measureLayer, measureLayerSource;
		for (var i = 0; i < layersArray.length; i++) {
			if (layersArray[i].getProperties().id == "measureLayer") {
				measureLayer = layersArray[i];
				measureLayerSource = measureLayer.getSource();
			}
		}
		var markLayer, markLayerSource;
		for (var i = 0; i < layersArray.length; i++) {
			if (layersArray[i].getProperties().id == "markLayer") {
				markLayer = layersArray[i];
				markLayerSource = markLayer.getSource();
			}
		}
		var cleardiv = document.createElement('button');
//		var clearFont = document.createElement('i');
		cleardiv.id = "Clear";
		cleardiv.className = 'drawPolygon';
		cleardiv.innerHTML = '清除';
//		clearFont.innerHTML =  '清除';
//		clearFont.className="iStyle";
		containerDiv.appendChild(cleardiv);
//		containerDiv.appendChild(clearFont);
		this.map.map.a.appendChild(containerDiv);
		var _this = this;
		cleardiv.onclick = function() {
			measureLayerSource.clear();
//			markLayerSource.clear();
			/*var Overlays = me._map.getOverlays().getArray();
			for (var i = Overlays.length - 2; i >= 0; i--) {
				me._map.removeOverlay(Overlays[i]);
			}
			var Draws = me._map.getInteractions().getArray();
			for (var i = Draws.length - 1; i >= 0; i--) {
				me._map.removeInteraction(Draws[i]);
			}*/
		}
	}
	
	/**
	 * 在地图上添加定位工具
	 */
	addLocation () {
		var me = this.map;
		var locationdiv = document.createElement('div');
		locationdiv.id = "Location";
		locationdiv.className = 'Location';
		locationdiv.title = '定位';
		this.map.el.dom.appendChild(locationdiv);
		var value, center;
		
		locationdiv.onclick = function() {
			// measureLayer.getSource().clear();
			this.showWin = Ext
					.create(
							'Ext.window.Window',
							{
								width : 300,
								height : 180,
								modal : true,
								name : 'chartWindow',
								layout : 'fit',
								shadow : false,
								title : '输入坐标',
								items : [ {
									xtype : 'container',
									defaults : {
										margin : '20 10 0 50',
										labelWidth : 90,
										width : 250,
									},
									items : [
											{
												xtype : 'textfield',
												fieldLabel : '经度',
												name : 'jd',
												allowBlank : false,
												margin : '10 10 0 10',
											},
											{
												xtype : 'textfield',
												fieldLabel : '纬度',
												name : 'wd',
												allowBlank : false,
												margin : '10 10 0 10',
											},
											{
												xtype : 'button',
												cls : 'btn_cus_func',
												text : '定位',
												width : 90,
												labelWidth : 190,
												textAlign : 'center',
												handler : function() {
													var jd = this
															.up()
															.down(
																	'textfield[name=jd]');
													var wd = this
															.up()
															.down(
																	'textfield[name=wd]');
													var value = [];
													value[0] = jd
															.getValue();
													value[1] = wd
															.getValue();
													if (value[0]
															&& value[1]) {
														center = [
																parseFloat(value[0]),
																parseFloat(value[1]) ];
														this
																.up()
																.up()
																.hide();
														var layersArray = me._map
																.getLayers()
																.getArray();
														var markLayer, markLayerSource;
														for (var i = 0; i < layersArray.length; i++) {
															if (layersArray[i]
																	.getProperties().id == "markLayer") {
																markLayer = layersArray[i];
																markLayerSource = markLayer
																		.getSource();
															}
														}
														var feature = new ol.Feature(
																{
																	geometry : new ol.geom.Point(
																			center),
																	name : 'My Point'
																});
														var style = new ol.style.Style(
																{
																	fill : new ol.style.Fill(
																			{
																				color : '#ffff00'
																			}),
																	stroke : new ol.style.Stroke(
																			{
																				color : '#ffff00',
																				width : 1
																			}),
																	image : new ol.style.Icon(
																			{
																				src : "js/app/frmwk/gis/images/定位.png"
																			})
																});
	
														feature
																.setStyle(style);
														markLayerSource
																.addFeature(feature);
														me._map
																.getView()
																.setCenter(
																		center);
													} else {
														Ext.Msg
																.alert(
																		"提示",
																		"请输入坐标！");
													}
												},
											},
											{
												xtype : 'button',
												cls : 'btn_cus_func',
												text : '返回',
												margin : '0 0 0 10',
												width : 90,
												textAlign : 'center',
												handler : function() {
													this
															.up()
															.up()
															.hide();
												}
											} ]
								} ]
							});
			this.showWin.show();
		};
	}
	
	/**
	 * 标记地图上某地
	 */
	addMarker(){
		var me =this.map;
		var layersArray = me._map.getLayers().getArray();
		var markLayer, markLayerSource;
		for(var i=0; i<layersArray.length; i++){
			if(layersArray[i].getProperties().id == "markLayer"){
				markLayer = layersArray[i];
				markLayerSource = markLayer.getSource();
			}
		}
		
		var markdiv = document.createElement('div');
		markdiv.id="mark";
		markdiv.className="mark";
		markdiv.title = '标记';
	    this.map.el.dom.appendChild(markdiv);
	    
	    var draw;
	    markdiv.onclick = function(e){//判断当前点击事件的div名称是哪一个
	    	var Draws = me._map.getInteractions().getArray();
	    	  for(var i=Draws.length-1; i>=0; i--){
	    		  me._map.removeInteraction(Draws[i]);
	    	  }
	    	if(draw){
		    	me._map.removeInteraction(draw); 
		    }
	    	draw = new ol.interaction.Draw({
		          source: markLayerSource,
		          type: ('Point'),
		          style:new ol.style.Style({
			          fill: new ol.style.Fill({
				            color: 'rgba(255, 255, 255, 0.2)'
				          }),
				          stroke: new ol.style.Stroke({
				            color: '#ffcc33',
				            width: 2
				          }),
				          image: new ol.style.Icon({
					          src: 'js/app/frmwk/gis/images/marker.png'
					        })
				        })
		        }); 
	    	me._map.addInteraction(draw); 
	    }
	}
	

	/**
	 * 在地图上添加鹰眼组件
	 */
	addOverviewMapControl() {
		var me = this.map;
		var OverviewMapControl = new ol.control.OverviewMap({
			className : 'ol-zy-overviewmap',
			collapsed : false,
			collapseLabel : '\u00BB',
			label : '\u00AB'
		});
		me._map.addControl(OverviewMapControl);
	}
	
	/**
	 * 在地图上添加显示鼠标位置组件
	 */
	addMousePositionControl() {
		var me =this.map;
		var textdiv = document.createElement('div');
		textdiv.id='mptext';
		textdiv.className='ol-mptext';
		textdiv.innerHTML = "鼠标位置：" ;
		var MousePositiondiv = document.createElement('div');
		MousePositiondiv.id="MousePosition";
	    this.map.el.dom.appendChild(MousePositiondiv);
	    MousePositiondiv.appendChild(textdiv);
	      
		var MousePositionControl = new ol.control.MousePosition({
			  className: 'ol-zy-mouse-position',
		      coordinateFormat: ol.coordinate.createStringXY(4),
		      projection: 'EPSG:4326',
		      target: MousePositiondiv
		    });
		
		me._map.addControl(MousePositionControl);
	}
	
	/**
	 * 在地图上添加比例尺组件
	 */
	addScaleLineControl () {
		var me =this.map;
		var textdiv = document.createElement('div');
		textdiv.id='sltext';
		textdiv.className='ol-sltext';
		textdiv.innerHTML = "当前比例尺   1:" ;
		
		var ScaleLinediv = document.createElement('div');
		ScaleLinediv.id="ScaleLine";
	    this.map.el.dom.appendChild(ScaleLinediv);
	    ScaleLinediv.appendChild(textdiv);
	      var scaleLineControl = new ol.control.ScaleLine({
	          className:'ol-zy-scale-line',
	          target: ScaleLinediv,
	          units:'metric'
	        });
		
		me._map.addControl(scaleLineControl);
	}
	
	addMapSwitch(){
		var me = this.map;
		var streetmap, imagemap, reliefmap;
		var layers = this.map._map.getLayers().getArray();
		var streetmap = this.map.getLyrById('amapvec') ? this.map
				.getLyrById('amapvec')
				: null;
		var imagemap = this.map.getLyrById('amapimg') ? this.map
				.getLyrById('amapimg')
				: null;
		// var reliefmap =
		// this.map.getLyrById('tdtter')?this.map.getLyrById('tdtter'):null;

		var streetmapdiv = document.createElement('div');
		streetmapdiv.id = 'streetmap';
		streetmapdiv.className = 'streetmap';
		this.map.el.dom.appendChild(streetmapdiv);

		var imagemapdiv = document.createElement('div');
		imagemapdiv.id = 'imagemap';
		imagemapdiv.className = 'imagemap';
		streetmapdiv.appendChild(imagemapdiv);

		/*
		 * var reliefmapdiv = document.createElement('div');
		 * reliefmapdiv.id = 'reliefmap'; reliefmapdiv.className =
		 * 'reliefmap'; streetmapdiv.appendChild(reliefmapdiv);
		 */

		streetmapdiv.onmouseover = function() {
			imagemapdiv.style.display = "block";
			// reliefmapdiv.style.display="block";
		};

		streetmapdiv.onmouseout = function() {
			imagemapdiv.style.display = "none";
			// reliefmapdiv.style.display="none";
		};
		streetmapdiv.onclick = function() {
			if (streetmap) {
				streetmap.setVisible(true);
			}
			if (imagemap) {
				imagemap.setVisible(false);
			}
			/*
			 * if(reliefmap){ reliefmap.setVisible(false); }
			 */
		};
		imagemapdiv.onclick = function(e) {
			e.cancelBubble = true;
			if (streetmap) {
				streetmap.setVisible(false);
			}
			if (imagemap) {
				imagemap.setVisible(true);
			}
			/*
			 * if(reliefmap){ reliefmap.setVisible(false); }
			 */
		};
		/*
		 * reliefmapdiv.onclick = function(e){ e.cancelBubble =
		 * true; if(streetmap){ streetmap.setVisible(false); }
		 * if(imagemap){ imagemap.setVisible(false); }
		 * if(reliefmap){ reliefmap.setVisible(true); } };
		 */
	}
}

export default Tools